Skip to content

Conversation

@notken12
Copy link
Contributor

Description

Fixes inference error from ort-wasm-simd-threaded.mjs not being bundled into ort.wasm.bundle.min.mjs as it is for other bundle.min.mjs builds.

Motivation and Context

To decrease my app's bundle size, I followed the conditional importing guide and imported the WASM-only build:

- import * as ort from 'onnxruntime-web';
+ import * as ort from 'onnxruntime-web/wasm';

After this change, creating an inference session would result in: TypeError: Failed to resolve module specifier './ort-wasm-simd-threaded.mjs'.

This was because ort-wasm-simd-threaded.mjs was not bundled into the build at onnxruntime-web/wasm, which points to ort.wasm.bundle.min.mjs, despite how its name suggests. In other builds with bundle in their name, the module is bundled, yet it was not done so in the WASM one. This PR bundles the Javascript WASM runtime in to match the other builds, fixing the error.

…dle.min.mjs` as it is for other `bundle.min.mjs` builds
@fs-eire
Copy link
Contributor

fs-eire commented May 22, 2025

need format code

@fs-eire
Copy link
Contributor

fs-eire commented May 26, 2025

It looks like the E2E tests are failing. please apply this change to fix it.

@notken12
Copy link
Contributor Author

@microsoft-github-policy-service agree

@fs-eire
Copy link
Contributor

fs-eire commented May 27, 2025

/azp run Linux QNN CI Pipeline, Win_TRT_Minimal_CUDA_Test_CI, Windows ARM64 QNN CI Pipeline, Windows GPU Doc Gen CI Pipeline, Windows x64 QNN CI Pipeline

@azure-pipelines
Copy link

Azure Pipelines successfully started running 5 pipeline(s).

@fs-eire
Copy link
Contributor

fs-eire commented May 29, 2025

Could you please merge to latest main branch, which includes the CI pipeline fix?

@fs-eire
Copy link
Contributor

fs-eire commented May 29, 2025

/azp run Linux QNN CI Pipeline, Win_TRT_Minimal_CUDA_Test_CI, Windows ARM64 QNN CI Pipeline, Windows GPU Doc Gen CI Pipeline, Windows x64 QNN CI Pipeline

@azure-pipelines
Copy link

Azure Pipelines successfully started running 5 pipeline(s).

@fs-eire fs-eire merged commit 9c18671 into microsoft:main May 30, 2025
82 checks passed
quic-ankus pushed a commit to CodeLinaro/onnxruntime that referenced this pull request Nov 25, 2025
…into `onnxruntime-web/wasm` build (microsoft#24836)

### Description
Fixes inference error from `ort-wasm-simd-threaded.mjs` not being
bundled into `ort.wasm.bundle.min.mjs` as it is for other
`bundle.min.mjs` builds.

### Motivation and Context
To decrease my app's bundle size, I followed the [conditional importing
guide](https://github.com/microsoft/onnxruntime-inference-examples/tree/main/js/importing_onnxruntime-web#conditional-importing)
and imported the WASM-only build:
```diff
- import * as ort from 'onnxruntime-web';
+ import * as ort from 'onnxruntime-web/wasm';
```
After this change, creating an inference session would result in:
`TypeError: Failed to resolve module specifier
'./ort-wasm-simd-threaded.mjs'`.

This was because `ort-wasm-simd-threaded.mjs` was not bundled into the
build at `onnxruntime-web/wasm`, which points to
`ort.wasm.bundle.min.mjs`, despite how its name suggests. In other
builds with `bundle` in their name, the module is bundled, yet it was
not done so in the WASM one. This PR bundles the Javascript WASM runtime
in to match the other builds, fixing the error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants